package com.db.rome.monitoring;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class HelloController {

    private static final String TITLE = "Rome monitoring";

    public static final String COMPONENT_STATUS_FILE = "C:\\work\\sources\\data\\components.csv";
    public static final String CONNECTION_STATUS_FILE = "C:\\work\\sources\\data\\connections.csv";

    @RequestMapping(method = RequestMethod.GET)
    public String printWelcome(ModelMap model) {
        Application application = new Application();
        DataStorage dataStorage = application.init();

        model.addAttribute("title", TITLE);
        model.addAttribute("connections", dataStorage.getConnectionStatusList());

        return "index";
    }
}